package learn.up.java.thread.threads;

/**
 *
 * @author NANUTO
 * @date 2017年12月12日 上午12:01:02
 */
public class Count {
	public static void main(String[] args) {
		Runnable runnable = new Runnable() {
			ThreadTest4 count = new ThreadTest4();

			public void run() {
				count.count();
			}
		};
		for (int i = 0; i < 10; i++) {
			new Thread(runnable).start();
		}
	}

}

class ThreadTest4 {
	int num = 0;

	public void count() {

		for (int i = 1; i <= 10; i++) {
			num += i;
		}
		System.out.println(Thread.currentThread().getName() + "-" + num);
	}
}